package com.example.jetpackcomposelayouts

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

/**
 * Author：young
 * .
 * Time： 26/9/2023 下午11:23 周二
 * .
 * Desc：
 *
 * 16-Slots API
 * https://www.bilibili.com/video/BV1ob4y1a7ad?p=16&spm_id_from=pageDriver&vd_source=e07cc8cc94eb22bd76722071b03cd199
 *
 */

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun LayoutStudy() {
    Scaffold(
        topBar = {
            TopAppBar(
                title = {
                    Text(text = "标题")
                },
                actions = {
                    IconButton(onClick = { }) {
                        Icon(imageVector = Icons.Filled.Favorite, contentDescription = null)
                    }
                },
                // https://blog.csdn.net/HugMua/article/details/129905267
                colors = TopAppBarDefaults.smallTopAppBarColors(
                    containerColor = MaterialTheme.colorScheme.primary, // 设置TopAppBar背景颜色
                    titleContentColor = Color.White, // 设置标题颜色
                    actionIconContentColor = Color.White // 设置标题栏按钮颜色
                ),
            )
        }
    ) { innerPadding ->
        BodyContent(modifier = Modifier.padding(innerPadding))
    }
}

@Composable
fun BodyContent(modifier: Modifier) {
    Column(modifier = modifier.padding(8.dp)) {
        Text(text = "我是标题")
        Text(text = "我是内容酷酷酷手机打开附件")
    }
}

